/**
 * Created by apple on 16/2/25.
 */

//es6
import template from './header.view.html';

//var template = require('./header.view.html');
class Directive {
    constructor () {
        return {
            controller      : 'headController',
            replace         : true,
            scope           : {},
            controllerAs    : 'vm',
            bindToController: true,
            templateUrl     : template,
            link            : this.link
        }
    }

    link ($scope, $element) {
        "ngInject"
        angular.element(document.body).on('click', function () {
            $scope.$apply(function () {
                $scope.vm.show = false;
            });
        });
        angular.element($element).find('input').on('click', function (e) {
            e.stopPropagation();
        });
    }
    static factory() {
        return new Directive();
    }
}

export default Directive;

